<html>
<head>
<title>管理中心</title>
<meta http-equiv=Content-Type content=text/html;charset=utf-8>
<#include "/xadmin/inc/common.html"/>
<link rel="stylesheet" type="text/css" href="${request.contextPath}/easyui/portal.css">
<script type="text/javascript" src="${request.contextPath}/easyui/jquery.portal.js"></script>
<style type="text/css">
.easyui-accordion ul{list-style-type:none;margin:0px; padding:10px;}
.easyui-accordion ul li{ padding:0px;}
.easyui-accordion ul li a{line-height:24px;}
.easyui-accordion ul li div{margin:2px 0px;padding-left:10px;padding-top:2px;}
.easyui-accordion ul li div.hover{border:1px dashed #99BBE8; background:#E0ECFF;cursor:pointer;}
.easyui-accordion ul li div.hover a{color:#416AA3;}
.easyui-accordion ul li div.selected{border:1px solid #99BBE8; background:#E0ECFF;cursor:default;}
.easyui-accordion ul li div.selected a{color:#416AA3; font-weight:bold;}
</style>
<script type="text/javascript">
$(function () {
	// 加载菜单
    // jQuery AJAX $.post(url, params, handler)
	$.ajax({
		url : 'listmenu.do',
		type : 'POST',
		dataType : 'text',
		success : function(data) {
		    //将文本字符串转化为 json 对象
			var jsonNodes = eval("(" + data + ")");
			//自动循环并处理
			$.each(jsonNodes.onemenu,function(i,obj){
				var menulist = "";
				menulist += "<ul>";
				$.each(jsonNodes.twomenu,function(j,json){
					if(json.sjcd==obj.cddm){
						menulist+="<li><div><a href=\"JavaScript:open('"+json.cdmc+"','"+json.cdurl+"')\"><span class='icon-mini-refresh'>&nbsp;&nbsp;&nbsp;&nbsp;</span>"+json.cdmc+"</a></div></li>"
					}
				});
				menulist +="</ul>";
				$('#menu').accordion('add', {title : obj.cdmc, content : menulist, iconCls : obj.cdicon });
			});
			// 处理最后一个菜单无样式
			$('#menu').accordion('add', {title : '',border:false, content : ''});
	        $('.easyui-accordion li a').hover(function(){
				$(this).parent().addClass("hover");
			},function(){
				$(this).parent().removeClass("hover");
			});
			$("#menu").accordion("select", "我的工作");
			// 处理最后一个菜单无样式
			$('#menu').accordion('remove','');
		},
		error : function(msg) {
			alert('菜单加载异常!');
		}
	});
	// 加载门户
	$('#pt').portal({border:false,fit:true});
	//
	var p0 = $('<div></div>').appendTo('body'); 
	p0.panel({title: '公司新闻', href: 'news.do?typeid=0'});
	$('#pt').portal('add', {panel: p0,columnIndex: 0});
	$('#pt').portal('disableDragging',p0);
	//
	var p1 = $('<div></div>').appendTo('body'); 
	p1.panel({ title: '规章制度', href: 'news.do?typeid=0'});
	$('#pt').portal('add', { panel: p1, columnIndex: 0});  
	$('#pt').portal('disableDragging',p1);
	//
	var p2 = $('<div></div>').appendTo('body'); 
	p2.panel({title: '通知公告', href: 'news.do?typeid=0'});
	$('#pt').portal('add', {panel: p2,columnIndex: 1});
	$('#pt').portal('disableDragging',p2);
	//
	var p3 = $('<div></div>').appendTo('body');    
	p3.panel({title: '最新消息',href: 'news.do?typeid=0'});    
	$('#pt').portal('add', {panel: p3,columnIndex: 1 });
	$('#pt').portal('disableDragging',p3);
	// 读取邮件
	if(${syscfg.showtip!0}=='1') {
		checkEmail();
	}
});
// 公共方法
function open(text, url) {
	if($("#tabs").tabs('tabs').length>${syscfg.shownum!15}) {
		alert('打开窗口超过最大值，请关闭不需要的窗口');
		return;
	}
	var content = '<div style="width:100%;height:100%;overflow:hidden;">' + 
		'<iframe src="'+url+'" scrolling="auto" style="width:100%;height:100%;border:0;" ></iframe></div>';
	if ($("#tabs").tabs('exists', text)) {
		$('#tabs').tabs('select', text);
		var tab = $('#tabs').tabs('getSelected');  // 获取选择的面板
		$('#tabs').tabs('update', {tab: tab,options: {title : text,	content : content,closable : true}});
	} else {
		$('#tabs').tabs('add', {title : text,content : content,closable : true,iconCls :'icon-mini-add'});
	}
}
var gridObj;
var windowObj;
var btn_save = {id : 'btn_save',text : '保存',iconCls : 'icon-save',handler : function() {windowObj.find('iframe')[0].contentWindow.doSave();}};
var btn_close = {id : 'btn_close',text : '关闭',iconCls : 'icon-cancel',handler : function() {windowObj.dialog('close');}};
function modalwindow(url,gObj,options,scroll){
	gridObj = gObj;
	windowObj = $('<div/>');
	var opts = $.extend({title : '&nbsp;',width : 640,height : 480,	resizable:true,
		onClose : function() {
			$(this).dialog('destroy');
		},buttons: [btn_save, btn_close]}, options);
	opts.modal = true;// 强制此dialog为模式化，无视传递过来的modal参数
	var sc = 'no';// 默认无滚动条
	if(scroll) sc = scroll;
	if (url) {
		opts.content = '<iframe id="dialogFrame" scrolling="' + sc + '" src="' + url + '" width="100%" height="100%" allowTransparency="true" frameBorder="0" border="0"></iframe>';
	}
	return windowObj.dialog(opts);
}
function closemodalwindow(flag,data){
	windowObj.dialog('close');
	if(flag){gridObj.datagrid('reload');}
	if(data){messagershow(data);}
}
function messagershow(data) {
	$.messager.show({height:130,title: '提示',timeout:5000,msg: data});	
}
function messageralert(data, icon) {
	var i = "info";
	if(icon) i = icon;
	$.messager.alert('提示', data, i);	
}
function noselectedalert() {
	messageralert('请选择相关数据进行操作！', 'warning');
}
// 检查邮件并提示
function checkEmail(){
	$.post("work/getNewEmail.do",
	    function(data){
		    if(data!=0){
		 	    var msg = '<b>您有 '+data+' 条站内消息</b><br><br><a href="javascript:open(\'我的消息\',\'work/emailManage.do\')">点击查看收件箱</a>';
				messagershow(msg);
		    }
		}
	);
	setTimeout('checkEmail()',${syscfg.checkemail!600}*1000);
}
</script>
</head>
<body class="easyui-layout">
    <!-- <div data-options="region:'north',border:false,href:'adminTop.do'" style="height:70px;"></div> -->
        <div data-options="region:'north',border:false" style="height:50px;" >
    	<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1">
            <tr>
                <td width="15%" style="background-color:#438eb8;">
                  <a href="adminindex">
                  		<img  src="${request.contextPath}/images/center.png" width="192" height="50" border="0" >
                  </a>
                </td>
                <td width="2%" style="background-color:#438eb8;">
                    &nbsp;
                </td>
                <td width="55%" align="right" style="background-color:#438eb8;">
                    <table cellpadding=0 cellspacing=0 align=center width=100%>
                        <tr>
                            <td height=20 align="right"><font color="#FFFFFF">
                            <b>欢迎您： ${user.fullname!}( ${user.username!})
                                  &nbsp; | &nbsp;部门：${user.depname!}
                                  &nbsp; | &nbsp;权限：${user.oskeyname!}
                                  &nbsp; | &nbsp;登录次数：${user.userlogins!}
                                  &nbsp; | &nbsp;登录时间：${user.lastlogin!}</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br>    
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="10%" style="background-image:url(${request.contextPath}/images/toptabback.jpg); background-repeat:no-repeat; border-left:1px solid #1972d2;">
                	<div align="center">
                    	<img style="padding-right:5px;" src="${request.contextPath}/images/indexright.gif" width="15" height="15">
                    	<a href="JavaScript:open('个人设置','system/userEditInfo.do')" ><font color="#FFFFFF"><b>个人设置</b></font></a>&nbsp;&nbsp;&nbsp;
                    	<img style="padding-right:5px;" src="${request.contextPath}/images/officon.gif" width="15" height="15">
                    	<a href="adminlogout"><font color="#FFFFFF"><b>退 出</b> </font></a>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div data-options="region:'west',title:'导航菜单',iconCls:'icon-mini-add',border:false" split="true" style="width:160px;" icon="icon-redo">
   		<div id="menu" class="easyui-accordion" fit="true" border="true"></div>
    </div>
    <div data-options="region:'center'" split="true">
    	<div data-options="fit:true" id="tabs" class="easyui-tabs" border="false">
			<div title="我的工作台" data-options="fit:true,iconCls:'icon-back'" style="width:100%;height:100%;overflow:hidden">
				<div id="pt" style="position:relative" data-options="fit:true">
					<div style="width:50%;overflow:hidden"></div>
					<div style="width:50%;overflow:hidden"></div>
				</div>
			</div>
		</div>
    </div>
    <div data-options="region:'south',border:false" style="height:18px;text-align: center;vertical-align:middle;background: #E0ECFF;">
   		<b>©2012-2017 <a href="javascript:open('官方网站','http://blog.ezerg.com')">ezerg.com</a></b>
    </div>
</body>
</html>